﻿import clr

def Nulling(p1, p2, p3):
    if p1.RenderImage != None:
        p1.Properties["renderImage"] = p1.RenderImage
    p1.RenderImage = None;
    return True

def onHover(p1, p2, p3):
    if p1.RenderImage == None:
        p1.RenderImage = p1.Properties["renderImage"];
    return True

def isHover(p1, p2, p3):
    if p1.Position.X <= p2.CurrentMouseState.X and (p1.Position.X + p1.Size.X) >= p2.CurrentMouseState.X:
        if p1.Position.Y <= p2.CurrentMouseState.Y and (p1.Position.Y + p1.Size.Y) >= p2.CurrentMouseState.Y:
            return True
        else:
            return False
    else:
        return False
    
def isPressed(p1, p2, p3):
    if p1.Position.X <= (p2.CurrentMouseState.X + p2.GetCameraPosition().X) and (p1.Position.X + p1.Size.X) >= (p2.CurrentMouseState.X + p2.GetCameraPosition().X):
        if p1.Position.Y <= (p2.CurrentMouseState.Y + p2.GetCameraPosition().Y) and (p1.Position.Y + p1.Size.Y) >= (p2.CurrentMouseState.Y + p2.GetCameraPosition().Y):
            if p2.CurrentMouseState.LeftButton:
                return True
            return False
        else:
            return False
    else:
        return False
    
def Quit_Pressed(p1, p2, p3):
    p2.Game.Exit()
    return True

def Demo_Map_Pressed(p1, p2, p3):
    p2.LoadMap("Demo_Map")
    return False

def Menu_2_Pressed(p1, p2, p3):
    p2.SetCameraPosition(2048, 2048)
    return True

def Back_Pressed(p1, p2, p3):
    p2.SetCameraPosition(0, 0)
    return True